package org.labo.sigmalivepaper;

import aurelienribon.tweenengine.TweenAccessor;

public class SpriteAccessor implements TweenAccessor<Sprite> {

	public static final int POSITION_X = 1;
	public static final int POSITION_Y = 2;
	public static final int POSITION_XY = 3;

	@Override
	public int getValues(Sprite target, int tweenType, float[] returnValues) {
		switch (tweenType) {
		case POSITION_X:
			returnValues[0] = target.getdX();
			return 1;
		case POSITION_Y:
			returnValues[0] = target.getdY();
			return 1;
		case POSITION_XY:
			returnValues[0] = target.getdX();
			returnValues[1] = target.getdY();
			return 2;
		default:
			assert false;
			return -1;
		}
	}

	@Override
	public void setValues(Sprite target, int tweenType, float[] newValues) {
		switch (tweenType) {
		case POSITION_X:
			target.setdX(newValues[0]);
			break;
		case POSITION_Y:
			target.setdY(newValues[0]);
			break;
		case POSITION_XY:
			target.setdX(newValues[0]);
			target.setdY(newValues[1]);
			break;
		default:
			assert false;
			break;
		}

	}

}
